package cn.edu.lcu.cs.javateaching.io;

import java.io.File;
import java.util.Arrays;

/**
 * 递归列目录演示
 * 
 * @author Ling
 *
 */
public class Dir {

	public static void main(String[] args) {
		String pathname = "d:/workspace";
		dir(pathname);
	}

	public static void dir(String pathname) {
		File file = new File(pathname);
		if (file.exists()) {
			System.out.println(file.getAbsolutePath());
			if (file.isDirectory()) {
				Arrays.stream(file.listFiles()).forEach(f -> dir(f.getAbsolutePath()));
			}
		}
	}
}
